Programming in HTML: Completed In 1 DAY by LRN AYOUB

Programming in HTML: Completed In 1 DAY by LRN AYOUB

Author:LRN, AYOUB [LRN, AYOUB]
Language: eng
Format: epub
Publisher: UNKNOWN
Published: 2020-12-02T16:00:00+00:00


This example shows how to create a file, body.css, containing style elements that can be applied to any document by using the l i n k element, as in Document 2.4b. The . c s s extension is standard, but not required. (You could use . t x t, for example, although there is no reason to confuse matters by doing that.) This example is very simple, but the concept is powerful because it makes it easy to create a standard style for all your documents which can be invoked with the l i n k element. The Impact font chosen for h1 headings may not be supported by all browsers. If not, a default font will be used in its place.

The attributes of l i n k include href, which contains the URL of the style sheet file, the r e l = " s t y l e s h e e t " (relationship) attribute, which describes how to use thefile (as a style sheet), and the type, which should be " t e x t / c s s ", just as it would be defined if you created a s t y l e element directly in the head element. In this example, body.css is in the same folder as st yl e 2. h tm. If you keep your style sheets in a separate folder, you will of course need to reference that folder.

This discussion has barely scratched the surface of style sheets. Style sheets can make your web pages more visually appealing and can greatly simplify your work on large Web projects. Some developers advocate replacing all individual formatting elements, such as f o n t and its attributes, with style sheet specifications. Despite the fact that the use of individual formatting elements is“deprecated” in favor of using CSS, there is little likelihood that support for individual elements will disappear from browsers in the foreseeable future. For the kinds of applications discussed in this book, cascading style sheets may sometimes be convenient, but they are not required.

2.6 Another Example

Documents 2.5a and 2.5b show how to use a style sheetfile to specify different background and text colors for different sections of text. Document 2.5a (rwb.css)

p . r e d { b a c k g r o u n d : r e d ; c o l o r : b l u e ; f o n t : 2 0 p t Times} d i v . w h i t e { b a c k g r o u n d : w h i t e ; c o l o r : r e d ; f o n t : 2 0 p t Times} s p a n . b l u e

{ b a c k g r o u n d : b l u e ; c o l o r : w h i t e ; f o n t : 2 0pt Times}

Document 2.



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.